package com.finalist.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Entity - 订单子项
 * 
 * @author Finalist IT Group
 * @version 3.0
 */
@Entity
@Table(name = "xx_order_children_item")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_order_child_item_sequence")
public class OrderChildrenItem extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 13015967525L;

	 /**
     * 验货状态
     */
    public enum InspectionStatus
    {
        /** 未验货*/
        init,
        /** 验货失败*/
        fail,
        /** 验货成功*/
        success
    }
    
	 /** 订单项 */
    private OrderItem orderItem;

    /** 是否验货 */
    private InspectionStatus inspectionStatus = InspectionStatus.init;
    
    /** 商品 */
    private Product product;
    
    /** 商品串码 */
    private String serialNo;
    
    public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	/**
     * 获取商品
     * 
     * @return 商品
     */
    @ManyToOne(fetch = FetchType.EAGER)
    public Product getProduct()
    {
        return product;
    }

    /**
     * 设置商品
     * 
     * @param product
     *            商品
     */
    public void setProduct(Product product)
    {
        this.product = product;
    }
    
    /**
     * 获取验货状态
     * 
     * @return 验货状态
     */
    @JsonProperty
    public InspectionStatus getInspectionStatus()
    {
        return inspectionStatus;
    }

    /**
     * 设置验货状态
     * 
     * @param   
     *       验货状态
     */
    public void setInspectionStatus(InspectionStatus inspectionStatus)
    {
        this.inspectionStatus = inspectionStatus;
    }
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "orderItem", nullable = false, updatable = false)
	public OrderItem getOrderItem() {
		return orderItem;
	}

	public void setOrderItem(OrderItem orderItem) {
		this.orderItem = orderItem;
	}
    
}
